# -*-coding=utf-8-*-

import numpy as np


class Ray():
    def __init__(self, position, direction, color):
        self.position = np.array(position, 'f')
        self.direction = np.array(direction, 'f')
        self.normalize()
        self.color = np.array(color, 'f')

    def normalize(self):
        """
        归一化方向向量
        """
        length = np.linalg.norm(self.direction)
        self.direction /= length
